/**
 * 
 */
package name.shamansir.tadah.data.parser;

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

import name.shamansir.tadah.data.parser.quicktask.EnParser;

/**
 * <dl>
 * <dt>Project:</dt> <dd>ta-dah</dd>
 * <dt>Package:</dt> <dd>name.shamansir.tadah.data.parser</dd>
 * </dl>
 *
 * <code>QuickTaskParsers</code>
 *
 * <p>Description</p>
 *
 * @author Ulric Wilfred <shaman.sir@gmail.com>
 * @date Feb 28, 2011 9:54:26 PM 
 *
 */
public class QuickTaskParsers {
    
    private static final Map<Locale, CanParseQuickTask> parsers =
            new HashMap<Locale, CanParseQuickTask>();
    
    public static CanParseQuickTask get(Locale locale) {
        CanParseQuickTask parser = parsers.get(locale);
        if (parser != null) return parser;
        if (locale.equals(Locale.ENGLISH)) parser = new EnParser();
        // else if.. TODO: other languages parsers
        if (parser == null) throw new IllegalStateException("No parser known for this locale");
        parsers.put(locale, parser);
        return parser;
    }

}
